import yaml
import os

file_path = os.path.join(r'C:\Users\ASUS\Desktop\soc_analyzer', 'config', 'playbooks.yaml')

try:
    with open(file_path, 'r', encoding='utf-8') as f:
        config = yaml.safe_load(f)
        if config and 'playbooks' in config:
            for p in config['playbooks']:
                event_type = p.get("event_type")
                print(f'Playbook ID: {p.get("playbook_id")}, Event Type repr: {repr(event_type)}')
        else:
            print('Failed to load playbooks or missing "playbooks" key.')
except FileNotFoundError:
    print(f'Error: File not found at {file_path}')
except yaml.YAMLError as e:
    print(f'Error parsing YAML: {e}')
except Exception as e:
    print(f'An unexpected error occurred: {e}')